import { IsString, IsNotEmpty, IsOptional, IsBoolean, MinLength, MaxLength } from 'class-validator'
import { ApiProperty } from '@nestjs/swagger'

/**
 * 用户登录数据传输对象
 */
export class LoginDto {
  @ApiProperty({
    description: '用户名或邮箱',
    example: 'admin'
  })
  @IsString({ message: '用户名或邮箱必须是字符串' })
  @IsNotEmpty({ message: '用户名或邮箱不能为空' })
  @MinLength(3)
  @MaxLength(100)
  identifier: string

  @ApiProperty({
    description: '密码',
    example: 'Password123!'
  })
  @IsString({ message: '密码必须是字符串' })
  @IsNotEmpty({ message: '密码不能为空' })
  @MinLength(1)
  @MaxLength(128)
  password: string

  @ApiProperty({
    description: '记住我',
    example: false,
    required: false
  })
  @IsOptional()
  @IsBoolean({ message: '记住我必须是布尔值' })
  rememberMe?: boolean
}
